/*
 * SingleAttributePanel.java
 *
 * Created on 9. Juni 2008, 23:10
 */

package twi.view;

import java.util.ArrayList;

import jtools.gui.CodeCompletionTextArea;
import twi.KeySearch;
import twi_project.TWI;

/**
 * 
 * @author Soeren
 */
public class SingleAttributePanel extends javax.swing.JPanel {

	/** Creates new form SingleAttributePanel */
	public SingleAttributePanel() {
		initComponents();
	}

	public SingleAttributePanel(String varName, ArrayList<String> domList) {
		initComponents();
		this.jTextField1.setText(varName);
		if (domList != null) {
			((CodeCompletionTextArea) this.jTextArea1).setWordList(KeySearch
					.getVocabulary(TWI.getInstance().getOntologieModel(),
							domList));
			for (int i = 0; i < domList.size(); i++)
				this.list1.addItem(domList.get(i));
		}
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed" desc="Generated
	// Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jTextField1 = new javax.swing.JTextField();
		jLabel2 = new javax.swing.JLabel();
		list1 = new java.awt.List();
		jLabel3 = new javax.swing.JLabel();
		jScrollPane1 = new javax.swing.JScrollPane();
		jTextArea1 = new CodeCompletionTextArea();

		jLabel1.setText("Variable Name");
		jLabel1.setName("jLabel1"); // NOI18N

		jTextField1.setEditable(false);
		jTextField1.setName("jTextField1"); // NOI18N

		jLabel2.setText("Domain");
		jLabel2.setName("jLabel2"); // NOI18N

		list1.setName("list1"); // NOI18N

		jLabel3.setText("Value");
		jLabel3.setName("jLabel3"); // NOI18N

		jScrollPane1.setName("jScrollPane1"); // NOI18N

		jTextArea1.setColumns(20);
		jTextArea1.setRows(1);
		jTextArea1.setName("jTextArea1"); // NOI18N
		jScrollPane1.setViewportView(jTextArea1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout
				.setHorizontalGroup(layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(jLabel1)
														.addComponent(jLabel2)
														.addComponent(jLabel3))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																list1,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																0,
																Short.MAX_VALUE)
														.addComponent(
																jTextField1,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																167,
																Short.MAX_VALUE)
														.addComponent(
																jScrollPane1,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																167,
																Short.MAX_VALUE))));
		layout
				.setVerticalGroup(layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel1)
														.addComponent(
																jTextField1,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(jLabel2)
														.addComponent(
																list1,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(jLabel3)
														.addComponent(
																jScrollPane1,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap(
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));
	}// </editor-fold>//GEN-END:initComponents

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JTextArea jTextArea1;
	private javax.swing.JTextField jTextField1;
	private java.awt.List list1;
	// End of variables declaration//GEN-END:variables

}
